home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / gg / ncurses-5.3.lha / ncurses-5.3 / misc / run_tic.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2002-10-24  |  6KB  |  153 lines

  1. #!/bin/sh
  2. ##############################################################################
  3. # Copyright (c) 1998,2000 Free Software Foundation, Inc.                     #
  4. #                                                                            #
  5. # Permission is hereby granted, free of charge, to any person obtaining a    #
  6. # copy of this software and associated documentation files (the "Software"), #
  7. # to deal in the Software without restriction, including without limitation  #
  8. # the rights to use, copy, modify, merge, publish, distribute, distribute    #
  9. # with modifications, sublicense, and/or sell copies of the Software, and to #
  10. # permit persons to whom the Software is furnished to do so, subject to the  #
  11. # following conditions:                                                      #
  12. #                                                                            #
  13. # The above copyright notice and this permission notice shall be included in #
  14. # all copies or substantial portions of the Software.                        #
  15. #                                                                            #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
  17. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
  19. # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
  20. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
  21. # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
  22. # DEALINGS IN THE SOFTWARE.                                                  #
  23. #                                                                            #
  24. # Except as contained in this notice, the name(s) of the above copyright     #
  25. # holders shall not be used in advertising or otherwise to promote the sale, #
  26. # use or other dealings in this Software without prior written               #
  27. # authorization.                                                             #
  28. ##############################################################################
  29. #
  30. # Author: Thomas E. Dickey 1996,2000
  31. #
  32. # $Id: run_tic.in,v 1.11 2001/10/14 00:44:33 tom Exp $
  33. # This script is used to install terminfo.src using tic.  We use a script
  34. # because the path checking is too awkward to do in a makefile.
  35. #
  36. # Assumes:
  37. #    The leaf directory names (lib, tabset, terminfo)
  38. #
  39. echo '** Building terminfo database, please wait...'
  40. #
  41. # The script is designed to be run from the misc/Makefile as
  42. #    make install.data
  43.  
  44. : ${suffix=}
  45. : ${DESTDIR=}
  46. : ${prefix=/gg}
  47. : ${exec_prefix=${prefix}}
  48. : ${bindir=${exec_prefix}/bin}
  49. : ${top_srcdir=..}
  50. : ${srcdir=.}
  51. : ${datadir=${prefix}/share}
  52. : ${ticdir=/gg/share/terminfo}
  53. : ${source=${top_srcdir}/misc/terminfo.src}
  54. : ${LN_S="ln -s"}
  55. : ${THAT_CC=cc}
  56. : ${THIS_CC=cc}
  57.  
  58. test -z "${DESTDIR}" && DESTDIR=
  59.  
  60. # Allow tic to run either from the install-path, or from the build-directory.
  61. # Do not do this if we appear to be cross-compiling.  In that case, we rely
  62. # on the host's copy of tic to compile the terminfo database.
  63. if test "$THAT_CC" = "$THIS_CC" ; then
  64. case "$PATH" in
  65. :*) PATH=../progs:${DESTDIR}$bindir$PATH ;;
  66. *) PATH=../progs:${DESTDIR}$bindir:$PATH ;;
  67. esac
  68. export PATH
  69. fi
  70.  
  71. #
  72. # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses
  73. # the PATH we just set.
  74. #
  75. NEWPATH=$PATH
  76. export NEWPATH
  77. PROG_BIN_DIR=${DESTDIR}$bindir
  78. export PROG_BIN_DIR
  79.  
  80. TERMINFO=${DESTDIR}$ticdir ; export TERMINFO
  81. umask 022
  82.  
  83. # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo.
  84. TICDIR=`echo $TERMINFO | sed -e 's@/share/@/lib/@'`
  85.  
  86. # Remove the old terminfo stuff; we don't care if it existed before, and it
  87. # would generate a lot of confusing error messages if we tried to overwrite it.
  88. # We explicitly remove its contents rather than the directory itself, in case
  89. # the directory is actually a symbolic link.
  90. ( cd $TERMINFO && rm -fr ? 2>/dev/null )
  91.  
  92. # If we're not installing into /usr/share/, we'll have to adjust the location
  93. # of the tabset files in terminfo.src (which are in a parallel directory).
  94. TABSET=`echo $ticdir | sed -e 's@/terminfo$@/tabset@'`
  95. if test "x$TABSET" != "x/usr/share/tabset" ; then
  96.     echo '** adjusting tabset paths'
  97.     TMP=${TMPDIR-/tmp}/$$
  98.     sed -e s:/usr/share/tabset:$TABSET:g $source >$TMP
  99.     trap "rm -f $TMP" 0 1 2 5 15
  100.     source=$TMP
  101. fi
  102.  
  103. cat <<EOF
  104. Running tic to install $TERMINFO ...
  105.  
  106.     You may see messages regarding unknown capabilities, e.g., AX.
  107.     These are extended terminal capabilities which can be compiled
  108.     using
  109.         tic -x
  110.     Read the INSTALL document before doing this - it can cause
  111.     problems for older ncurses applications.
  112.  
  113. EOF
  114. if ( $srcdir/shlib tic$suffix -s -o $TERMINFO $source )
  115. then
  116.     echo '** built new '$TERMINFO
  117. else
  118.     echo '? tic could not build '$TERMINFO
  119.     exit 1
  120. fi
  121.  
  122. # Make a symbolic link to provide compatibility with applications that expect
  123. # to find terminfo under /usr/lib.  That is, we'll _try_ to do that.  Not
  124. # all systems support symbolic links, and those that do provide a variety
  125. # of options for 'test'.
  126. if test "$TICDIR" != "$TERMINFO" ; then
  127.     ( rm -f $TICDIR 2>/dev/null )
  128.     if ( cd $TICDIR 2>/dev/null )
  129.     then
  130.         cd $TICDIR
  131.         TICDIR=`pwd`
  132.         if test $TICDIR != $TERMINFO ; then
  133.             # Well, we tried.  Some systems lie to us, so the
  134.             # installer will have to double-check.
  135.             echo "Verify if $TICDIR and $TERMINFO are the same."
  136.             echo "The new terminfo is in $TERMINFO; the other should be a link to it."
  137.             echo "Otherwise, remove $TICDIR and link it to $TERMINFO."
  138.         fi
  139.     else
  140.         cd ${DESTDIR}$prefix
  141.         # Construct a symbolic link that only assumes $ticdir has the
  142.         # same $prefix as the other installed directories.
  143.         RELATIVE=`echo $ticdir|sed -e 's:^'$prefix'/::'`
  144.         if test "$RELATIVE" != "$ticdir" ; then
  145.             RELATIVE=../`echo $ticdir|sed -e 's:^'$prefix'/::' -e 's:^/::'`
  146.         fi
  147.         if ( ln -s $RELATIVE $TICDIR )
  148.         then
  149.             echo '** linked '$TICDIR' for compatibility'
  150.         fi
  151.     fi
  152. fi
  153.